<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2017/7/22
 * Time: 9:14
 */

namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class CarFactory extends Model
{
    /**
     * 关联到模型的数据表
     *
     * @var string
     */
    protected $table = 'car_factory';


    public static function edit( $id, $data){

        $now = Date('Y-m-d H:i:s');
        $sql = "update car_factory set `name`=?, updated_at='$now', brand_id=? where id='".$id."'";
        $data = DB::update( $sql,[ $data['name'], $data['brand_id'] ] );
        return $data;

    }
}